﻿using System;

namespace QuickAppLibrary
{
    /// <summary>
    /// PriorEmployer Class 
    /// </summary>
    [Serializable]
    public sealed class PriorEmployer : AddressAbstract
    {
        //Class varibles
        private const string dateFormat = "MM/dd/yyyy";

        //Class Properties/Fields
        //Used like class varibles
        public string business { get; set; }
        public string businessType { get; set; }
        public string businessTitle { get; set; }
        public string businessManager { get; set; }
        public string businessPhone { get; set; }
        public string businessSalary { get; set; }
        public string businessReasonsForLeaving { get; set; }
        public string businessResponsibilities { get; set; }
        public DateTime businessFrom { get; set; }
        public DateTime businessTo { get; set; }

        //Specific Class Properties
        public string businessFromString
        {
            get { return businessFrom.ToString(dateFormat); }
        }
        public string businessToString
        {
            get { return businessTo.ToString(dateFormat); }
        }

        /// <summary>
        /// Sets an instance of PriorEmployer
        /// </summary>
        public PriorEmployer() { }
        
        /// <summary>
        /// Sets an instance of PriorEmployer for each property
        /// </summary>
        /// <param name="business"></param>
        /// <param name="type"></param>
        /// <param name="address"></param>
        /// <param name="city"></param>
        /// <param name="state"></param>
        /// <param name="title"></param>
        /// <param name="manager"></param>
        /// <param name="phone"></param>
        /// <param name="salary"></param>
        /// <param name="leaving"></param>
        /// <param name="responsiblities"></param>
        /// <param name="from"></param>
        /// <param name="to"></param>
        public PriorEmployer(string business, string type, string address, string address2, string city, string state, string zip,
                                string title, string manager, string phone, string salary, string leaving,
                                string responsiblities, DateTime from, DateTime to)
        {
            this.business = business;
            this.street = address;
            this.street2 = address2;
            this.city = city;
            this.businessFrom = from;
            this.businessManager = manager;
            this.businessPhone = phone;
            this.businessReasonsForLeaving = leaving;
            this.businessResponsibilities = responsiblities;
            this.businessSalary = salary;
            this.state = salary;
            this.businessTitle = title;
            this.businessTo = to;
            this.businessType = type;
            this.zip = zip;
        }

        /// <summary>
        /// Method for object comparision; tested by business name
        /// </summary>
        /// <param name="emp"></param>
        /// <returns>Boolean</returns>
        public bool Compare(PriorEmployer emp)
        {
            if (this.business == emp.business)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// Static Method for Compare; testing by business name
        /// </summary>
        /// <param name="tempA"></param>
        /// <param name="tempB"></param>
        /// <returns>Boolean</returns>
        public static bool Compare(PriorEmployer tempA, PriorEmployer tempB)
        {
            if (tempA.business == tempB.business)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// Overriden, returns business name
        /// </summary>
        /// <returns>String of business name</returns>
        public override string ToString()
        {
            return this.business;
        }
    }
}
